{include file='common/header'}
<ol class='breadcrumb'  >
      <li ><a href="">admin</a></li>
      <li ><a href="">user</a></li>
      <li class='active'>lst</li>
</ol>
<table class="table table-striped table-bordered table-hover table-responsive">
 <h2 class="text-center">用户列表</h2>
 <a class='btn btn-primary' href="{:url('user/add')}"><span class="glyphicon glyphicon-plus"></span>&nbsp;ADD</a>
 <tr class="info">
    <td>用户名</td>
    <td>emial</td>
    <td>tel</td>
    <td>头像</td>
    <td>创建时间</td>
    <td>操作</td>
 </tr>
 {if condition="isset($user) "}
{volist name='user' id='user'}
 <tr class="">
    <td>{$user.uname}</td>
    <td>{$user.email}</td>
    <td>{$user.tel}</td>
    <td><img src="/uploads/{$user.image}" height='40px' alt=""></td>
    <td>{$user.create_time}</td>
    <td>
       <a class="btn btn-primary" href="{:url('user/edit',['id'=>$user['id']])}">
          <span class="glyphicon glyphicon-pencil"></span>&nbsp;修改
       </a>
       <button class="btn btn-primary shanchu" id={$user.id}><span class="glyphicon glyphicon-trash"></span>&nbsp;删除</button>
    </td>
 </tr>
 {/volist} 
 {/if}
</table>
<script>
$('.shanchu').click(function(){
    tip=confirm('您确定要删除吗，删了就不能恢复了哦！！');
    obj=$(this);
    if(tip==true){
        $.post("{:url('user/delete')}",{id:this.id},function(e){
           if(e==1){
             obj.parent().parent().hide();
           }else{
             alert('删除失败');
           }
        });
    }
})
</script> 
{include file='common/footer'}